package com.scala.oop.triat

/**
 * Created by Administrator on 2018/1/28/028.
 *
 * 抽象字段 继承必须赋值
 *
 *
 *
 */
trait FieldTrait {
  val msg:String = "ok ,Im a field"
  val msg2:String
}
class BoyField(val name:String) extends FieldTrait{
  val msg2:String = "oh my god"
  def sayHello()= println("hi "+name+","+msg+",msg2:"+msg2)

}

object Field{
  def main(args: Array[String]) {
    val b = new BoyField("eric")
    b.sayHello
  }
}
